package com.yixun.qfbao.response.premises.detail;

import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.List;

import com.yixun.qfbao.apidto.PremisesDetailResDto;
import com.yixun.qfbao.util.StringUtil;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

/**
 * @author zilong.liu
 * @date 2020-8-12
 */
@Data
public class DetailBaseInfo implements Serializable{
	
	private static final long serialVersionUID = 1L;
	
	public DetailBaseInfo() {
	}

	public DetailBaseInfo(PremisesDetailResDto detailResDto) {
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
		this.checkInTime = detailResDto.getCheckInTime() == null? null: 
			sdf.format(detailResDto.getCheckInTime()).replaceAll("-", ".");
		this.openingTime = detailResDto.getOpeningTime() == null? null: 
			sdf.format(detailResDto.getOpeningTime()).replaceAll("-", ".");
		this.buildingTypeNames = StringUtil.getListFromSplitString(detailResDto.getBuildingTypeCN(), ",");
		this.decorationTypeName = detailResDto.getDecorationTypeName();
		this.devCompanyName = detailResDto.getBuildingCompany();
		this.rightYears = detailResDto.getRightYears();
	}

	/**
	 * 需要转换成标准的日期时间
	 */
	@ApiModelProperty(value = "开盘时间")
	private String openingTime;
	
	@ApiModelProperty(value = "交房时间")
	private String checkInTime;
	
	/**
	 * 根据楼盘表中的开发商Id，从tm_company获取
	 */
	@ApiModelProperty(value = "开发商公司名称")
	private String devCompanyName;
	
	@ApiModelProperty(value = "产权年限")
	private String rightYears;
	
	@ApiModelProperty(value = "建筑类型")
	private List<String> buildingTypeNames;
	
	@ApiModelProperty(value = "装修状况")
	private String decorationTypeName;
	
}
